<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- 1. 安装 vue-router 路由模块 -->
    <script src="https://cdn.bootcss.com/vue-router/3.1.3/vue-router.js"></script>
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- 我们要监听 文本框数据的改变，这样才知道 什么时候去拼接 出一个fullname -->
        <!-- 如何监听到 文本框的数据改变？？？ -->
        <input type="text" v-model="firstname" @keyup='getFullname'>+
        <input type="text" v-model="lastname" @keyup='getFullname'>=
        <input type="text" v-model="fullname">
    </div>


    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                firstname: '',
                lastname: '',
                fullname: ''
            },
            methods: {
                getFullname() {
                    this.fullname = this.firstname + '-' + this.lastname
                }
            }
        });
    </script>
</body>
</html>